package com.example.springboot159.bean;

import com.alibaba.fastjson.JSONObject;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

import java.io.UnsupportedEncodingException;
import java.util.*;

@Document(indexName = "index_user",type = "type_user")
public class User {
    @Field
    private String id;
    @Field
    private String phone;
    @Field
    private String username;
    @Field
    private String pwd;
    @Field
    private String sex;
    @Field
    private String age;
    public User() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "id='" + id + '\'' +
                ", phone='" + phone + '\'' +
                ", username='" + username + '\'' +
                ", pwd='" + pwd + '\'' +
                ", sex='" + sex + '\'' +
                ", age='" + age + '\'' +
                '}';
    }


    public static void main(String[] args) throws UnsupportedEncodingException {
        Map<String ,Object> params = new HashMap<>();
        Map<String ,Object> params2 = new HashMap<>();
        params2.put("name","wtf");
        params.put("tag",params2);
        System.out.println(JSONObject.toJSONString(params));
        JSONObject jsonObject = new JSONObject();
        JSONObject jsonObject1 = new JSONObject();
        jsonObject1.put("name","wtf");
        jsonObject.put("tag",jsonObject1);
        System.out.println(JSONObject.toJSONString(params));
        System.out.println(jsonObject.toJSONString());

        List list = new ArrayList<>();
        list.add(1);
        System.out.println(list.get(0));
    }
}
